# -*- coding: utf-8 -*-
"""
@Time    : 2021/10/9 2:46
@Author  : Leibuyun
@File    : 3.3 数字的格式化输出.py
"""

if __name__ == '__main__':
    x = 1234.56789
    print(format(x, '.2f'))
    print(format(x, '>10.2f'))  # 右对齐
    print(format(x, '<5.2f'))  # 左对齐
    print(format(x, '^10.2f'))  # 居中对齐
    print(format(x, ','))  # 每3位用逗号分隔
    print(format(x, 'e'))  # 指数计法
    print('{:.2f}'.format(x))  # '[<>^]?width[,]?(.digits)?' 问好表示可选
    print('%.2f' % x)
